package com.express.ExpRefundRecord.web;


import com.aqgj.util.JsonWrapper;
import com.express.ExpRefundRecord.service.ExpRefundRecordManager;
import com.express.ExpRelease.bean.ExpRelease;
import com.express.ExpRelease.service.ExpReleaseManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;


@Controller
@RequestMapping("ztc/expRefundRecord")
public class ExpRefundRecordAction {

    @Autowired
    private ExpRefundRecordManager expRefundRecordManager;
    @Autowired
    private ExpReleaseManager expReleaseManager;

    /**
     * 获取退款记录
     *
     * @param pageNo   页码
     * @param pageSize 每页大小
     * @return
     */
    @RequestMapping("getRefundRecordList")
    @ResponseBody
    public HashMap<String, Object> getRefundRecordList(@RequestParam(defaultValue = "1") Integer pageNo, @RequestParam(defaultValue = "10") Integer pageSize) {
        return expRefundRecordManager.getRefundRecordList(pageNo, pageSize);
    }

    /**
     * 搜索快递订单.
     *
     * @param orderNumber  订单编号
     * @return
     */
    @RequestMapping("searchOrder")
    @ResponseBody
    public HashMap<String,Object> searchOrder(@RequestParam(required = true) String orderNumber){
        ExpRelease expRelease=expReleaseManager.search(orderNumber);
        if(expRelease==null){
            return JsonWrapper.failureWrapperMsg("获取订单详情失败！");
        }
        return JsonWrapper.successWrapper(expRelease);
    }
}